package com.guigu.service.impl.manufacture;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.guigu.mapper.manufacture.MProcedureModuleMapper;
import com.guigu.pojo.manufacture.MProcedureModule;
import com.guigu.service.manufacture.MProcedureModuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Mr.Zhang
 * @since 2024-12-06
 */
@Service
public class MProcedureModuleServiceImpl extends ServiceImpl<MProcedureModuleMapper, MProcedureModule> implements MProcedureModuleService {

    @Autowired
    private MProcedureModuleMapper procedureModuleMapper;


    @Override
    public ArrayList<MProcedureModule> initialModule(Integer id) {
        QueryWrapper<MProcedureModule> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("PARENT_ID",id);
        queryWrapper.orderByAsc("DETAILS_NUMBER");
        ArrayList<MProcedureModule> mProcedureModules = (ArrayList<MProcedureModule>) procedureModuleMapper.selectList(queryWrapper);
        return mProcedureModules;
    }
    @Autowired
    private MProcedureModuleMapper mProcedureModuleMapper;

    @Override
    public List<MProcedureModule> getProcedureModuleByParentId(Integer parentId) {
        QueryWrapper<MProcedureModule> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("PARENT_ID", parentId);

        return mProcedureModuleMapper.selectList(queryWrapper);
    }
}
